import { Prefab, resources, Node, find, instantiate } from "cc";

export class UIManager {
  UIRoot: Node = null

  openPanel(name: string) {

    // 1.加载面板
    if (this.UIRoot == null) {
      this.UIRoot = find('UIRoot')
    }

    resources.load('UI/prefab' + name, Prefab, (err: Error, data: Prefab) => {
      let panel = instantiate(data)
      this.UIRoot.addChild(panel)

    })
  }

  closePanel(name: string) {

  }

  openDialog() {

  }

  closeDialog() {

  }
}


